package com.sais.manage.boot.cms.controller;

import com.sais.common.entity.Result;
import com.sais.manage.boot.cms.dto.ContentDTO;
import com.sais.manage.boot.cms.service.IContentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 宿舍管理平台-新闻内容controller
 *
 * @author zwp
 * @date 2020/2/17
 */
@Slf4j
@CrossOrigin
@RestController
@Api(tags = "文章内容管理")
@RequestMapping("/api/cms/content")
public class ContentController {

    @Resource
    private IContentService contentService;

    @ApiOperation("根据文章id 查询 文章内容")
    @RequestMapping(value = "/select/{articleId}", method = RequestMethod.GET)
    public Result selectContent(@PathVariable("articleId") String articleId) {
        ContentDTO content = contentService.selectContentByArticleId(articleId);
        return new Result().data("content", content);
    }
}
